<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <#include "include/_meta.html">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>修改客户信息</title>

</head>
<body>

<article class="page-container">
    <form class="form form-horizontal" id="form-admin-edit" >
        <input type="hidden" name="uid" id="uid" value="${data.uid}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(data.name)!""}" placeholder="" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>初始密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" autocomplete="off" value="${(data.clientpwd)!""}" placeholder="" id="clientpwd1" name="clientpwd1">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" autocomplete="off" value="${(data.clientpwd)!""}" placeholder="" id="clientpwd2" name="clientpwd2" onkeyup="checkpassword()">
                <span id="tishi"></span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(data.mobile)!""}" placeholder="" id="mobile" name="mobile">
            </div>
        </div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input id="clientedit" class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
                <#--onclick="$('#form-admin-add').submit()"-->
            </div>

        </div>
    </form>
</article>


<#include "include/_footer.html">

<script type="text/javascript">
    $("#clientedit").click(function () {
        $.ajax({
            url:"/edit",
            type:"POST",
            dataType:"JSON",
            data:$("#form-admin-edit").serialize(),
            success:function (data) {

                var index = parent.layer.getFrameIndex(window.name);
                parent.getClientList();
                parent.layer.close(index);
            }
        })
    })

    //jQuery验证两次密码是否相同
    function checkpassword() {
        var password = document.getElementById("clientpwd1").value;
        var repassword = document.getElementById("clientpwd2").value;

        if(password == repassword) {
            document.getElementById("tishi").innerHTML="<br><font color='green'>两次密码输入一致</font>";
            document.getElementById("submit").disabled = false;

        }else {
            document.getElementById("tishi").innerHTML="<br><font color='red'>两次输入密码不一致!</font>";
            document.getElementById("submit").disabled = true;
        }
    }


</script>
</body>